package com.avic.szzx.controller.TestController;

import com.alibaba.fastjson.JSONObject;
import com.avic.szzx.config.NebulaTemplate;
import com.avic.szzx.controller.bean.NebulaResult;
import com.vesoft.nebula.client.graph.exception.IOErrorException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class NebulaController {

    @Resource
    NebulaTemplate nebulaTemplate;

    @GetMapping("/addVertex")
    public Object addJSON() throws IOErrorException {
        String sql = "insert vertex equipment_information_correspondence(name,processing_manufacturing_unit,org_identity,created_by,creation_date,last_updated_by,last_updated_date,last_updated_ip,version) values \"TEST9\":(\"CHENJUN TEST4\",\"主机厂XXX1\",\"ORG ROOT\",\"admin\",\"2023-12-12\",\"user1\",\"2023-12-12\",\"10.216.90.199\",\"2\");";
        JSONObject nebulaResult = nebulaTemplate.executeObject(sql);
        return nebulaResult;
    }

}
